Repository navigation
Conversation
WindowCaptionButton gains hovered and pressed. They show the hover or pressed look when the pointer is handled outside Flutter, such as a Windows 11 maximize button that reports HTMAXBUTTON so the system opens Snap Layouts (leanflutter#122).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
WindowCaptionButtongets two optional parameters,hoveredandpressed(defaultfalse). When either one is set, the button shows that look even though Flutter itself does not see the pointer.Why
On Windows 11 the Snap Layouts flyout (#122) opens only when the top-level window answers
HTMAXBUTTONtoWM_NCHITTESTover the maximize button. From then on the pointer belongs to the system: Flutter getsWM_MOUSELEAVE, and itsMouseRegiondrops the hover state. The app gets hover, press and click back from the non-client messages (WM_NCMOUSEMOVE,WM_NCLBUTTONDOWN/UP), but there was no way to show that state on the button.Usage:
Tests
test/window_caption_button_test.dartcovers: the idle look, the hover look with no pointer, pressed winning over hovered, and the close button's own hover color.Note:
flutter pub getonmainneeds Flutter 3.50, so I ran the same test on the identical change in the 0.5.2 code, where it passes (4/4). The change to the code is the same on both.